package com.ming.attendance.Jobs;

import com.ming.attendance.mapper.BeaconMapper;
import com.ming.attendance.po.Beacon;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

public class UnbindJob implements Job {
    @Autowired
    private BeaconMapper bm;

    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        // 从context中获取要改变using的beacon的beaconId
        String beaconId = (String) jobExecutionContext.getJobDetail().getJobDataMap().get("beaconId");
        Beacon beacon = new Beacon();
        beacon.setBeaconId(beaconId);
        beacon.setUsing(0);
        bm.updateBeacon(beacon);

    }
}
